package com.lottery.im.module.result.adapter;

import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lottery.im.R;
import com.lottery.im.api.result.entity.FictitiousRecord;
import java.util.List;

public class FictitiousRecordAdapter extends BaseQuickAdapter<FictitiousRecord,BaseViewHolder>{

  public FictitiousRecordAdapter(@Nullable List<FictitiousRecord> data) {
    super(R.layout.item_fictitious_record, data);
  }

  @Override protected void convert(BaseViewHolder helper, FictitiousRecord item) {

    String issueId = item.getIssueId();
    helper.setText(R.id.tv_issue,issueId.substring(issueId.length()-4,issueId.length()));
    helper.setText(R.id.tv_result,item.getResultName());

    if (TextUtils.isEmpty(item.getBallResult())){
      helper.setText(R.id.tv_ball_result,"--");
    }else {
      helper.setText(R.id.tv_ball_result,item.getBallResult());
    }

    switch (item.getStatus()){
      case -1:
        helper.setText(R.id.tv_status,"未开奖");
        helper.setTextColor(R.id.tv_status, ContextCompat.getColor(mContext,R.color.blue_4f));
        break;
      case 0:
        helper.setText(R.id.tv_status,"不中");
        helper.setTextColor(R.id.tv_status, ContextCompat.getColor(mContext,R.color.text_color_normal));
        break;
      case 1:
        helper.setText(R.id.tv_status,"中");
        helper.setTextColor(R.id.tv_status, ContextCompat.getColor(mContext,R.color.red_fa));
        break;
    }


  }
}
